package pers.ree.demo.jvm;

public class StringInternDemo {

    public static void main(String[] args) {
        String a = "hello";

        String b = new String("hello");

        System.out.println(a == b);

        String c = "world";

        System.out.println(c.intern() == c);

        String d = new String("mike");

        System.out.println(d.intern() == d);

        String e = new String("jo") + new String("hn");

        System.out.println(e.intern() == e);

        String f = new String("ja") + new String("va");

        System.out.println(f.intern() == f);
    }
}
